from sklearn.linear_model import LogisticRegression
import numpy as np

# 创建数据
X = np.array([[1], [2], [3], [4]])
y = np.array([0, 0, 1, 1])

# 训练模型
model = LogisticRegression()
model.fit(X, y)

# 预测
print("Prediction for X=2.5:", model.predict([[2.5]]))